<?php

namespace App\Http\Controllers;

use App\Utils\Curl;
use Illuminate\Http\Request;

class OrderController extends Controller
{
  /* 现金购买 */
  //登录
  public function createOrder(Request $request)
  {
    $header = ['Authorization:' . $request->header('Authorization')];
    return Curl::sendPostRequest($header, $request->all(), Config('site.gate_root') . '/s/cashBilling/bills');
  }

  //检查订单状态
  public function checkOrderStatus(Request $request, $billNo)
  {
    $header = ['Authorization:' . $request->header('Authorization')];
    return Curl::sendGetRequest($header, Config('site.gate_root') . '/s/cashBilling/bills/' . $billNo);
  }

  //获取推荐产品
  public function getRecommendations(Request $request)
  {
    return null;
  }

  /* 课时购买 */
  //登录
  public function createOrder1(Request $request)
  {
    $header = ['Authorization:' . $request->header('Authorization')];
    return Curl::sendPostRequest($header, $request->all(), Config('site.gate_root') . '/s/bills');
  }

  //检查订单状态
  public function checkOrderStatus1(Request $request, $billNo)
  {
    $header = ['Authorization:' . $request->header('Authorization')];
    return Curl::sendGetRequest($header, Config('site.gate_root') . '/s/bills/' . $billNo);
  }

  //获取推荐产品
  public function getRecommendations1(Request $request)
  {
    $header = ['Authorization :' . $request->header('Authorization')];
    return Curl::sendGetRequest($header, Config('site.api_root') . '/bills/recommendation');
  }
}
